#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{

	int fd = open("file.txt",O_WRONLY | O_CREAT | O_TRUNC,0666);
	dup2(fd,1);
	fprintf(stdout,"666\n");
	fprintf(stdout,"888\n");
//	close(1);
//	int fd = open("file.txt",O_WRONLY | O_CREAT,0666);
//	printf("printf,fd:%d\n",fd);
//	fprintf(stdout,"666\n");
//	fprintf(stdout,"888\n");
//	fflush(stdout);
//	close(fd);
//	return 0;
}
